Prometheus (software)
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
top
Prometheus is a free software application used for event monitoring and alerting.cite-ref-2[2] It records metrics in a time series database (allowing for high dimensionality) built using an HTTP pull model, with flexible queries and real-time alerting.cite-ref-turnbull2018-3-0[3]cite-ref-website-4-0[4] The project is written in Go and licensed under the Apache 2 License, with source code available on GitHub.cite-ref-github-5-0[5]
Contents
• History
• Versions
• PromQL
• See also
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
History
Prometheus was developed at SoundCloud starting in 2012,cite-ref-brazil2018-6-0[6] when the company discovered that its existing metrics and monitoring tools (using StatsD and Graphite) were insufficient for their needs. Specifically, they identified needs that Prometheus was built to meet, including a multi-dimensional data model, operational simplicity, scalable data collection, and a powerful query language, all in a single tool.cite-ref-soundcloud-prometheus-7-0[7] The project was open-source from the beginning and began to be used by Boxever and Docker users as well, despite not being explicitly announced.cite-ref-soundcloud-prometheus-7-1[7]cite-ref-docker-prometheus-8-0[8] Prometheus was inspired by the monitoring tool Borgmon used at Google.cite-ref-9[9]cite-ref-10[10]
In May 2016, the Cloud Native Computing Foundation (CNCF) accepted Prometheus as its second incubated project, after Kubernetes.cite-ref-cncf-incubates-prometheus-11-0[11] In August 2018, the CNFC announced that the Prometheus project had graduated.cite-ref-cncf-prometheus-graduates-12-0[12]
Versions
Architecture
A typical monitoring platform with Prometheus is composed of multiple tools:
• Multiple exporters typically run on the monitored host to export local metrics.
• Prometheus to centralize and store the metrics.
• Alertmanagercite-ref-15[15] to trigger alerts based on those metrics.
• Grafana to produce dashboards.
• PromQL is the query language used to create dashboards and alerts.
Data storage format
Prometheus data is stored in the form of metrics, with each metric having a name that is used for referencing and querying it. Each metric can be drilled down by an arbitrary number of key=value pairs (labels). Labels can include information on the data source (which server the data is coming from) and other application-specific breakdown information such as the HTTP status code (for metrics related to HTTP responses), query method (GET versus POST), endpoint, etc. The ability to specify an arbitrary list of labels and to query based on these in real time is why Prometheus' data model is called multi-dimensional.cite-ref-data-model-16-0[16]cite-ref-soundcloud-prometheus-7-4[7]cite-ref-docker-prometheus-8-1[8]
Data collection
Prometheus collects data in the form of time series. The time series are built through a pull model: the Prometheus server queries a list of data sources (sometimes called exporters) at a specific polling frequency. Each of the data sources serves the current values of the metrics for that data source at the endpoint queried by Prometheus. The Prometheus server then aggregates data across the data sources.cite-ref-soundcloud-prometheus-7-6[7] Prometheus has a number of mechanisms to automatically discover resources that should be used as data sources.cite-ref-18[18]
PromQL
Prometheus provides its own query language PromQL (Prometheus Query Language) that lets users select and aggregate data. PromQL is specifically adjusted to work in convention with a Time-Series Database and therefore provides time-related query functionalities. Examples include the rate() function, the instant vector and the range vector which can provide many samples for each queried time series.cite-ref-19[19] Prometheus has four clearly defined metric types around which the PromQL components revolve. The four types are:cite-ref-20[20]
• Gauge
• Counter
• Histogram
• Summary
Example code
# A metric with label filtering
go_gc_duration_seconds{instance="localhost:9090", job="alertmanager"}
# Aggregation operators
sum by (app, proc) (
instance_memory_limit_bytes - instance_memory_usage_bytes
) / 1024 / 1024
cite-ref-21[21]
Alerts and monitoring
Configuration for alerts can be specified in Prometheus which specifies a condition that needs to be maintained for a specific duration in order for an alert to trigger. When alerts trigger, they are forwarded to the Alertmanager service. Alertmanager can include logic to silence alerts and also to forward them to email, Slack, or notification services such as PagerDuty.cite-ref-22[22] Some other messaging systems like Microsoft Teamscite-ref-23[23] could be configured using the Alertmanager Webhook Receiver as a mechanism for external integrations.cite-ref-24[24] also Prometheus Alerts can be used to receive alerts directly on android devices even without the requirement of any targets configuration in Alert Manager.cite-ref-25[25]
Time Series Database
Prometheus has its own implementation of time series database where it stores the recent data (1-3 hours of data by default) in a combination of memorycite-ref-26[26] and mmap-ed files from disk,cite-ref-27[27] and persists the older data in the form of blockscite-ref-28[28] with an inverted index. Inverted index is well suited for Prometheus data format and querying patterns.cite-ref-29[29] As part of background maintenance, smaller blocks are merged together to form bigger blocks in a process called compactioncite-ref-30[30] to improve query efficiency by having fewer blocks to read. Prometheus also uses a Write-Ahead-Log (WAL)cite-ref-31[31] to provide durability against crashes.
Dashboards
Interoperability
Prometheus favors white-box monitoring. Applications are encouraged to publish (export) internal metrics to be collected periodically by Prometheus.cite-ref-33[33] Some exporters and agents for various applications are available to provide metrics.cite-ref-34[34] Prometheus supports some monitoring and administration protocols to allow interoperability for transitioning: Graphite, StatsD, SNMP, JMX, and CollectD.
Standardization into OpenMetrics
There is an effort to promote Prometheus exposition format into a standard known as OpenMetrics.cite-ref-36[36] Some products adopted the format: InfluxData's TICK suite,cite-ref-37[37] InfluxDB, Google Cloud Platform,cite-ref-38[38] DataDogcite-ref-39[39] and New Relic.cite-ref-40[40]cite-ref-41[41]
See also
References
cite-note-11. Latest release at Github
cite-note-22. ↑ "Overview". prometheus.io.
cite-note-website-44. ↑ "Prometheus: From metrics to insight. Power your metrics and alerting with a leading open-source monitoring solution". Retrieved December 26, 2018.
cite-note-soundcloud-prometheus-77. ↑ citerefvolzrabenstein2015Volz, Julius; Rabenstein, Björn (January 26, 2015). "Prometheus: Monitoring at SoundCloud". SoundCloud.
cite-note-docker-prometheus-88. ↑ "Monitor Docker Containers with Prometheus". 5π Consulting. January 26, 2015. Archived from the original on January 3, 2019. Retrieved December 26, 2018.
cite-note-99. ↑ citerefmurphybeyerjonespetoff2016Murphy, Niall; Beyer, Betsy; Jones, Chris; Petoff, Jennifer (2016). Site Reliability Engineering:How Google Runs Production Systems. O'Reilly Media. ISBN 978-1491929124. Even though Borgmon remains internal to Google, the idea of treating time-series data as a data source for generating alerts is now accessible to everyone through those open source tools like Prometheus ...
cite-note-1010. ↑ citerefvolz2017Volz, Julius (4 September 2017). "PromCon 2017: Conference Recap" – via YouTube. I joined SoundCloud back in 2012 coming from Google...we didn't yet have any monitoring tools that that works with this kind of dynamic environment. We were kind of missing the way Google did its monitoring for its own internal cluster scheduler and we were very inspired by that and finally decided to build our own open-source solution.
cite-note-cncf-incubates-prometheus-1111. ↑ "Cloud Native Computing Foundation Accepts Prometheus as Second Hosted Project". Cloud Native Computing Foundation. May 9, 2016. Retrieved December 26, 2018.
cite-note-cncf-prometheus-graduates-1212. ↑ citerefevans2018Evans, Kristen (August 9, 2018). "Cloud Native Computing Foundation Announces Prometheus Graduation". Retrieved December 26, 2018.
cite-note-1313. ↑ "Prometheus 1.0 Is Here". Cloud Native Computing Foundation. July 18, 2016. Retrieved December 26, 2018.
cite-note-1414. ↑ "New Features in Prometheus 2.0.0". Robust Perception. November 8, 2017. Retrieved December 26, 2018.
cite-note-data-model-1616. ↑ "Data model". Prometheus. Retrieved December 26, 2018.
cite-note-integrations-prometheus-1717. ↑ "Integrations - Prometheus". prometheus.io.
cite-note-1818. ↑ "Prometheus: Collects metrics, provides alerting and graphs web UI". March 18, 2017. Retrieved December 26, 2018.
cite-note-1919. ↑ "Querying Prometheus". Retrieved November 4, 2019.
cite-note-2020. ↑ "Metric types". prometheus.io. Retrieved 2024-06-29.
cite-note-2222. ↑ citerefdubey2018Dubey, Abhishek (March 25, 2018). "AlertManager Integration with Prometheus". Retrieved December 26, 2018.
cite-note-2323. ↑ citerefdanuka2020Danuka, Praneeth (March 8, 2020). "Alerting for Cloud-native Applications with Prometheus". Retrieved October 18, 2020.
cite-note-2424. ↑ "Integrations | Prometheus".
cite-note-2525. ↑ "Prometheus alerts - Apps on Google Play".
cite-note-2626. ↑ "Prometheus TSDB (Part 1): The Head Block | Ganesh Vernekar". ganeshvernekar.com. 2020-09-19. Retrieved 2025-01-17.
cite-note-2727. ↑ "Prometheus TSDB (Part 3): Memory Mapping of Head Chunks from Disk | Ganesh Vernekar". ganeshvernekar.com. 2020-10-02. Retrieved 2025-01-17.
cite-note-2828. ↑ "Prometheus TSDB (Part 4): Persistent Block and its Index | Ganesh Vernekar". ganeshvernekar.com. 2020-10-18. Retrieved 2025-01-17.
cite-note-2929. ↑ "Prometheus TSDB (Part 5): Queries | Ganesh Vernekar". ganeshvernekar.com. 2021-01-04. Retrieved 2025-01-17.
cite-note-3030. ↑ "Prometheus TSDB (Part 6): Compaction and Retention | Ganesh Vernekar". ganeshvernekar.com. 2021-07-27. Retrieved 2025-01-17.
cite-note-3131. ↑ "Prometheus TSDB (Part 2): WAL and Checkpoint | Ganesh Vernekar". ganeshvernekar.com. 2020-09-26. Retrieved 2025-01-17.
cite-note-3232. ↑ citerefryckbosch2017Ryckbosch, Frederick (July 28, 2017). "Prometheus monitoring: Pros and cons". Retrieved December 26, 2018.
cite-note-3333. ↑ citerefprometheusPrometheus. "Instrumentation - Prometheus". prometheus.io.
cite-note-3434. ↑ "Exporters". prometheus.io.
cite-note-3535. ↑ citerefprometheusPrometheus. "Prometheus - Monitoring system & time series database". prometheus.io.
cite-note-3636. ↑ "OpenMetrics". GitHub. 2018-11-13.
cite-note-3838. ↑ "Announcing Stackdriver Kubernetes Monitoring".
cite-note-3939. ↑ "DataDogHQ".
cite-note-4040. ↑ "Send Prometheus metric data to New Relic | New Relic Documentation". docs.newrelic.com. Retrieved 16 April 2025.
cite-note-4141. ↑ "Configure Prometheus OpenMetrics integrations | New Relic Documentation". docs.newrelic.com. Retrieved 16 April 2025.
Further reading
• citerefruss2015Russ, McKendrick (2015-12-15). Monitoring Docker : monitor your Docker containers and their apps using various native and third-party tools with the help of this exclusive guide!. Birmingham, UK. ISBN 9781785885501. OCLC 933610431.{{cite book}}: CS1 maint: location missing publisher (link)
• citerefkaewkasi2016Kaewkasi, Chanwit (2016). Native Docker Clustering with Swarm. Packt Publishing, Limited. ISBN 978-1786469755.
External links